<template>
    <div>
        <el-form label-width="140px" :disabled="!isCanEdit">
            <el-form-item label="使用单位名称">
                <el-input v-model="deviceInfo.usingUnityName" style="width: 300px" maxlength="100" />
            </el-form-item>
            <div class="flex-v">
                <el-form-item label="使用单位代码" style="margin-left: 0px;">
                    <el-input v-model="deviceInfo.usingUnityCode" style="width: 300px" maxlength="20" />
                </el-form-item>
                <el-form-item label="小区(楼盘)名称" style="margin-left: 0px;">
                    <el-input v-model="deviceInfo.villageName" style="width: 300px" maxlength="100" />
                </el-form-item>
            </div>
            <div class="flex-v">
                <el-form-item label="出厂编号" style="margin-left: 0px;">
                    <el-input v-model="deviceInfo.factoryNo" style="width: 300px" maxlength="20" />
                </el-form-item>
                <el-form-item label="登记注册机构" style="margin-left: 0px;">
                    <el-input v-model="deviceInfo.registerName" style="width: 300px" maxlength="100" />
                </el-form-item>
            </div>
            <div class="flex-v">
                <el-form-item label="登记注册日期" style="margin-left: 0px;">
                    <el-input v-model="deviceInfo.registerDate" style="width: 300px" maxlength="100" />
                </el-form-item>
                <el-form-item label="使用登记号" style="margin-left: 0px;">
                    <el-input v-model="deviceInfo.useRegistrationCode" style="width: 300px" maxlength="20" />
                </el-form-item>
            </div>
            <div class="flex-v">
                <el-form-item label="注册登记人员" style="margin-left: 0px;">
                    <el-input v-model="deviceInfo.registerUserName" style="width: 300px" maxlength="100" />
                </el-form-item>
                <el-form-item label="设备代码" style="margin-left: 0px;">
                    <el-input v-model="deviceInfo.code" style="width: 300px" maxlength="20" />
                </el-form-item>
            </div>
            <div class="flex-v">
                <el-form-item label="设备注册代码" style="margin-left: 0px;">
                    <el-input v-model="deviceInfo.registrationCode" style="width: 300px" maxlength="100" />
                </el-form-item>
                <el-form-item label="设备种类" style="margin-left: 0px;">
                    <!-- <el-select v-model="deviceInfo.className" placeholder="请选择" style="width: 300px">
                        <el-option label="扶梯" value="1" />
                        <el-option label="电梯" value="2" />
                    </el-select> -->
                    <el-input v-model="deviceInfo.className" style="width: 300px" maxlength="100" />
                </el-form-item>
            </div>
            <div class="flex-v">
                <el-form-item label="设备类别" style="margin-left: 0px;">
                    <!-- <el-select v-model="deviceInfo.deviceStatus" placeholder="请选择" style="width: 300px">
                        <el-option label="自动扶梯" value="1" />
                        <el-option label="曳引驱动电梯" value="2" />
                    </el-select> -->
                    <el-input v-model="deviceInfo.categoryName" style="width: 300px" maxlength="100" />
                </el-form-item>
                <el-form-item label="设备品种" style="margin-left: 0px;">
                    <!-- <el-select v-model="deviceInfo.deviceStatus" placeholder="请选择" style="width: 300px">
                        <el-option label="自动扶梯" value="1" />
                        <el-option label="曳引驱动电梯" value="2" />
                    </el-select> -->
                    <el-input v-model="deviceInfo.varietyName" style="width: 300px" maxlength="100" />
                </el-form-item>
            </div>
            <div class="flex-v">
                <el-form-item label="设备名称" style="margin-left: 0px;">
                    <el-input v-model="deviceInfo.name" style="width: 300px" maxlength="100" />
                </el-form-item>
                <el-form-item label="设备型号" style="margin-left: 0px;">
                    <el-input v-model="deviceInfo.productIdentifier" style="width: 300px" maxlength="20" />
                </el-form-item>
            </div>
            <div class="flex-v">
                <el-form-item label="设备状态" style="margin-left: 0px;">
                    <el-select v-model="deviceInfo.productStatus" placeholder="请选择" style="width: 300px">
                        <el-option label="正常" value="1" />
                        <el-option label="停用" value="0" />
                    </el-select>
                </el-form-item>
                <el-form-item label="单位内部编号" style="margin-left: 0px;">
                    <el-input v-model="deviceInfo.unityIdentifier" style="width: 300px" maxlength="20" />
                </el-form-item>
            </div>
            <div class="flex-v">
                <el-form-item label="使用地点" style="margin-left: 0px;">
                    <el-input v-model="deviceInfo.usingAddress" style="width: 300px" maxlength="100" />
                </el-form-item>
            </div>
            <div class="flex-v">
                <el-form-item label="是否增设电梯" style="margin-left: 0px;">
                    <el-radio-group v-model="deviceInfo.isAdd" style="width: 300px">
                        <el-radio :label="1" value="1">是</el-radio>
                        <el-radio :label="0" value="0">否</el-radio>
                    </el-radio-group>
                </el-form-item>
                <!-- <el-form-item label="电梯编号" style="margin-left: 0px;">
                    <el-input v-model="deviceInfo.user" style="width: 300px" maxlength="20" />
                </el-form-item> -->
            </div>
        </el-form>
    </div>
</template>
  
<script setup>
import {
    apiGetTaskDeviceInfo
} from "@/api/detection";

const deviceInfo = ref({})

const props = defineProps({
    infoId: {
        type: Number,
        default: -1
    },
    isCanEdit: {
        type: Boolean,
        default: true
    },
});
const id = ref()

//详情中的设备信息
const getDeviceInfo = () => {
    apiGetTaskDeviceInfo(id.value).then((res) => {
        if (res && res.data) {
            deviceInfo.value = res.data
        }
    })
}

watch(() => props.infoId, (val) => {
    id.value = val
    getDeviceInfo()
}, {
  immediate: true
})

</script>
  
<style scoped></style>